package com.example.spring_mysql.datascope

import com.mybatisflex.core.FlexGlobalConfig
import com.mybatisflex.core.dialect.DbType
import com.mybatisflex.core.dialect.DialectFactory
import com.mybatisflex.core.logicdelete.LogicDeleteProcessor
import com.mybatisflex.spring.boot.MyBatisFlexCustomizer
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

/**
 * @ClassName MybatisFlexConfiguration
 * @Author 程序员Mars
 * @Date 2024/5/11 14:58
 * @Version 1.0
 */
@Configuration
class MybatisFlexConfiguration : MyBatisFlexCustomizer {

    @Bean
    fun logicDeleteProcessor(): LogicDeleteProcessor {
        return EntityLogicDeleteListener()
    }

    override fun customize(p0: FlexGlobalConfig?) {

        // 注册查询权限监听方言
//        DialectFactory.registerDialect(DbType.MYSQL, SimplePermissionDialect())
    }
}
